from django.http import JsonResponse


class SimpleMiddleware:
    def __init__(self, get_response):
        self.get_response = get_response


    def __call__(self, request):
        if request.user.username in ["sherk"] and (not request.path.startswith("/admin")):
            return JsonResponse({"result": False,
                                "message":"You're banned to use swechat for 30 days"})
        response = self.get_response(request)

        return response